SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dbo].[usp_UpdateApplyingRecordCompany]

	(
	@param_id INT,
	@param_handle_time SMALLDATETIME,
	@param_user_handle NVARCHAR(50),
	@param_result NVARCHAR(50),
	@param_employinunit_message TEXT
	)

AS
	/* SET NOCOUNT ON */
	DECLARE @param_last_stage INT
	SET @param_last_stage=(SELECT current_stage FROM dbo.JOL_Recruitment_Position,dbo.JOL_Recruitment_ApplyingRecords
						  WHERE 
						  recruit_position=dbo.JOL_Recruitment_Position.id AND dbo.JOL_Recruitment_ApplyingRecords.id=@param_id)
	UPDATE dbo.JOL_Recruitment_ApplyingRecords
	SET
	handle_time=@param_handle_time,
	user_handle= @param_user_handle,
	last_stage = @param_last_stage,
	result=@param_result,
	employinunit_message=@param_employinunit_message
	WHERE
	id=@param_id
	RETURN
GO
